package com.landinfo.service.impl;

import com.landinfo.service.FlyToService;
import com.landinfo.domain.FlyTo;
import com.landinfo.repository.FlyToRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


/**
 * Service Implementation for managing FlyTo.
 */
@Service
@Transactional
public class FlyToServiceImpl implements FlyToService{

    private final Logger log = LoggerFactory.getLogger(FlyToServiceImpl.class);

    private final FlyToRepository flyToRepository;

    public FlyToServiceImpl(FlyToRepository flyToRepository) {
        this.flyToRepository = flyToRepository;
    }

    /**
     * Save a flyTo.
     *
     * @param flyTo the entity to save
     * @return the persisted entity
     */
    @Override
    public FlyTo save(FlyTo flyTo) {
        log.debug("Request to save FlyTo : {}", flyTo);
        return flyToRepository.save(flyTo);
    }

    /**
     * Get all the flyTos.
     *
     * @param pageable the pagination information
     * @return the list of entities
     */
    @Override
    @Transactional(readOnly = true)
    public Page<FlyTo> findAll(Pageable pageable) {
        log.debug("Request to get all FlyTos");
        return flyToRepository.findAll(pageable);
    }

    /**
     * Get one flyTo by id.
     *
     * @param id the id of the entity
     * @return the entity
     */
    @Override
    @Transactional(readOnly = true)
    public FlyTo findOne(Long id) {
        log.debug("Request to get FlyTo : {}", id);
        return flyToRepository.findById(id).get();
    }

    /**
     * Delete the flyTo by id.
     *
     * @param id the id of the entity
     */
    @Override
    public void delete(Long id) {
        log.debug("Request to delete FlyTo : {}", id);
        flyToRepository.deleteById(id);
    }
}
